home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Table / Include / TblTrckr.h < prev   
Encoding:
Text File  |  1995-11-08  |  5.1 KB  |  188 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                TblTrckr.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef TBLTRCKR_H
  11. #define TBLTRCKR_H
  12.  
  13. #ifndef TBLPART_H
  14. #include "TblPart.h"
  15. #endif
  16.  
  17. // ----- ODF Includes -----
  18.  
  19. #ifndef FWTRACKR_H
  20. #include "FWTrackr.h"
  21. #endif
  22.  
  23. // ----- OS Includes -----
  24.  
  25. #ifndef FWLINSHP_H
  26. #include "FWLinShp.h"
  27. #endif
  28.  
  29. #ifndef FWRECT_H
  30. #include "FWRect.h"
  31. #endif
  32.  
  33. //========================================================================================
  34. //    Forward declarations
  35. //========================================================================================
  36.  
  37. #if FW_LIB_EXPORT_PRAGMAS
  38. #pragma import on
  39. #endif
  40. class FW_CLASS_ATTR FW_CFacetContext;
  41. #if FW_LIB_EXPORT_PRAGMAS
  42. #pragma import off
  43. #endif
  44.  
  45. class FW_CLASS_ATTR CTablePart;
  46. class FW_CLASS_ATTR CTableFrame;
  47. class FW_CLASS_ATTR CTableSelection;
  48.  
  49. //========================================================================================
  50. //    class CTableDropTracker
  51. //========================================================================================
  52.  
  53. class FW_CLASS_ATTR CTableDropTracker : public FW_CDropTracker
  54. {
  55. //----------------------------------------------------------------------------------------
  56. //    Initialization/Destruction
  57. //
  58. public:
  59.     CTableDropTracker(Environment* ev, 
  60.                 CTablePart* part,
  61.                 CTableFrame* frame,
  62.                 ODFacet* facet,
  63.                 const CCell& sourceCell);
  64.     virtual ~CTableDropTracker();
  65.     
  66. //----------------------------------------------------------------------------------------
  67. //    New API
  68. //
  69. public:    
  70.     // ----- Tracking -----
  71.     virtual FW_CPoint     BeginTracking(Environment* ev, 
  72.                             const FW_CPoint& anchorPoint);
  73.     virtual FW_CPoint     ContinueTracking(Environment* ev,
  74.                             const FW_CPoint& anchorPoint, 
  75.                             const FW_CPoint& previousPoint, 
  76.                             const FW_CPoint& currentPoint);
  77.  
  78. private:
  79.     void    Hilite(Environment* ev, const CCell& cell, ODFacet* facet);
  80.     
  81. //----------------------------------------------------------------------------------------
  82. //    Data Members
  83. //
  84. private:
  85.     CTableFrame*        fTableFrame;
  86.     CTablePart*            fTablePart;
  87.     CCell                fSourceCell;
  88.     CCell                fCurCell;
  89.     FW_Boolean            fHiliteOn;
  90. };
  91.  
  92. //========================================================================================
  93. //    class CCrossShape
  94. //========================================================================================
  95.  
  96. class CCrossShape
  97. {
  98. //---------------------------------------------------------------------------------------
  99. //    Constructors/Destructors
  100. //
  101.   public:
  102.     CCrossShape(const FW_CPoint& brCell, FW_CPoint& brFrm);
  103.  
  104. //---------------------------------------------------------------------------------------
  105. //    Public API
  106. //
  107.   public:
  108.     void    SetHLineToMove();
  109.     void    SetVLineToMove();
  110.  
  111.     // ----- Rendering -----
  112.     void    Render(FW_CGraphicContext& graphicContext);
  113.  
  114.     // ----- Transform -----
  115.     void    MoveShape(FW_CFixed deltaX, FW_CFixed deltaY);
  116.  
  117. //---------------------------------------------------------------------------------------
  118. //    Data Members
  119. //
  120.   private:
  121.     FW_CLineShape        vLine;
  122.     FW_CLineShape        hLine;
  123. };
  124.  
  125. //========================================================================================
  126. //    class CGridLineTracker
  127. //========================================================================================
  128.  
  129. class FW_CLASS_ATTR CGridLineTracker : public FW_CTracker
  130. {
  131.   public:
  132.     CGridLineTracker(Environment* ev, 
  133.                      FW_CView* view,
  134.                      ODFacet* facet,
  135.                      ETableLoc tl,
  136.                      FW_CRect dragArea,
  137.                      FW_CPoint borders);
  138.     virtual ~CGridLineTracker();
  139.  
  140. //----------------------------------------------------------------------------------------
  141. //    Required Overrides
  142. //
  143.   public:
  144.     virtual FW_CPoint     BeginTracking(Environment* ev, 
  145.                                     const FW_CPoint& anchorPoint);
  146.     virtual FW_CPoint     ContinueTracking(Environment* ev,
  147.                                     const FW_CPoint& anchorPoint, 
  148.                                     const FW_CPoint& previousPoint, 
  149.                                     const FW_CPoint& currentPoint);
  150.     virtual FW_Boolean     EndTracking(Environment* ev,
  151.                                     const FW_CPoint& anchorPoint, 
  152.                                     const FW_CPoint& lastPoint);
  153.  
  154. //----------------------------------------------------------------------------------------
  155. //    Accessor Functions
  156. //
  157.   public:
  158.     const FW_CPoint&    GetOldBorders();
  159.     const FW_CPoint&    GetNewBorders();
  160.  
  161. //----------------------------------------------------------------------------------------
  162. //    Data Members
  163. //
  164.   private:
  165.     FW_Boolean            fHorizMove;        // resize horizontally?
  166.     FW_Boolean            fVertMove;        // resize vertically?
  167.     FW_CRect            fDragArea;        // permissible drag area
  168.     FW_CPoint            fOldBorders;
  169.     FW_CPoint            fNewBorders;
  170.     CCrossShape            fCross;            // cursor
  171. };
  172.  
  173. //========================================================================================
  174. //    CGridLineTracker Inlines
  175. //========================================================================================
  176.  
  177. inline const FW_CPoint& CGridLineTracker::GetOldBorders()
  178.     return fOldBorders; 
  179. }
  180.  
  181. inline const FW_CPoint& CGridLineTracker::GetNewBorders()
  182.     return fNewBorders; 
  183. }
  184.  
  185. #endif
  186.